﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using UtilZ.Dotnet.Ex.ZLog;
using UtilZ.Dotnet.Ex.Log;
using UtilZ.Dotnet.Ex.Base;

namespace DotnetWinFormApp
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            string path = PathEx.ExecutablePath;
            //Console.WriteLine(path);

            ZLoger.OutputOption = ZLogerOutputOptions.Loger;
            //ZLoger.Customer = ZLogOutput;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FTestSNTChannel());
        }

        private static void ZLogOutput(LogItem logItem)
        {
            switch(logItem.Level)
            {
                case LogLevel.Trace:
                case LogLevel.Debug:
                case LogLevel.Info:
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.WriteLine(logItem.Message);
                    break;
                case LogLevel.Warn:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(logItem.Message);
                    break;
                case LogLevel.Error:
                case LogLevel.Fatal:
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(logItem.Message);
                    break;
                default:
                    break;
            }
        }
    }
}
